package org.net.device.dao;

import java.sql.SQLException;
import java.util.ArrayList;

import javax.sql.DataSource;

import org.dolphin.base.data.dao.SimpleDAO;
import org.net.device.trap.trapdatas;

public class trapdao extends SimpleDAO {
	public trapdao(DataSource ds) {
		super(ds);
		reset();
	}
	
	public void reset() {
		setTable_name("events");
		setClvo(trapdatas.class);
		String[] fields={"id","infotype","datetimes","ip","port","eventtype","eventid","content","timestamps"};
		setFields(fields);
		setKeyField("id");		
	}
	
	public trapdatas getDeviceinfo() throws SQLException {
		ArrayList al = (ArrayList)this.getalldata();
		if (al.size() > 0) {
			return (trapdatas)al.get(0);
		}
		return null;
	}
}
